<!doctype html>
<html ng-app="demo">
<head>
    <meta charset="UTF-8"/>
    <title>调用已有的Web服务且使用AngularJS</title>
    <script src="/js/angular.min.js"></script>
    <script>
        angular.module('demo', [])
            .controller('Hello', function($scope, $http) {
                $http.get('http://rest-service.guides.spring.io/greeting').
                then(function(response) {
                    $scope.greeting = response.data;
                });
            });
    </script>
</head>
<body>
<div ng-controller="Hello">
    <h2>调用已有的Web服务且使用AngularJS</h2>
    <p>The ID is {{greeting.id}}</p>
    <p>The content is {{greeting.content}}</p>
</div>
</body>
</html>